package acm;

import java.util.Scanner;

public class a21 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];
        int max, xb = 0;
        max=a[0];
        for (int i=0;i<n;i++){
            a[i]=in.nextInt();
            if (a[i]>max){
                max=a[i];
                xb=i;
            }
        }
        System.out.print(max);
        System.out.print(" "+xb);

    }
}
